<template>
	<view>
		<form style="overflow: hidden;">
			<view class="cu-form-group">
				<view class="title">姓名</view>
				<input placeholder="请输入姓名" name="input" v-model="name"></input>
			</view>
			<view class="cu-form-group">
				<view class="title">身份证号码</view>
				<input placeholder="请输入身份证号码" name="input" type="idcard" @input="inputIDCard"></input>
			</view>
		</form>
		<view class="flex align-center justify-center margin-top-sm">
			<text class="text-xs text-grey">说明: 真实姓名必须为当前微信认证的姓名,否则将无法提现收益</text>
		</view>
		<view class="confirm-btn">
			<button class="margin-bottom bg-theme margin" @click="confirmCertfication">确认</button>
		</view>
	</view>
</template>

<script>
	import * as RegExp from '@/utils/RegExp.js'
	export default {
		data() {
			return {
				name:'',
				Idcard:''
			};
		},
		methods:{
			checkData(){
				if(!RegExp.userName.test(this.name)){
					uni.showToast({
						icon:'none',
						title:'请输入正确的姓名'
					})
					return false
				}
				if(!RegExp.IDCard.test(this.Idcard)){
					uni.showToast({
						icon:'none',
						title:'请输入正确的身份证号'
					})
					return false
				}
			},
			inputIDCard(e){
				this.Idcard = e.detail.value
			},
			confirmCertfication(){
				this.checkData()
				let params = {
					name:this.name,
					idcard:this.Idcard
				}
				console.log('params',params)
			}
		}
	}
</script>

<style lang="scss">
.title{
	width: 190rpx;
}
.confirm-btn{
	position: absolute;
	bottom: 80rpx;
	width: 100%
}
</style>
